package com.level2app.ui.app;

import android.os.Bundle;

import com.level2app.R;
import com.level2app.adapter.TransactionsAdapter;
import com.level2app.base.BaseFragment;
import com.level2app.base.BaseViewModel;
import com.level2app.databinding.FragmentWalletBinding;
import com.level2app.ui.app.view.WalletFrgViewModel;
import com.level2app.ui.wallet.AmountDetailsActivity;
import com.level2app.ui.wallet.TransactionsListActivity;
import com.level2app.utils.JumpIntent;
import com.level2app.utils.ToastHelper;
import com.level2app.view.popWindow.TipsPopupWindow;

import java.util.ArrayList;
import java.util.List;

public class WalletFragment extends BaseFragment<FragmentWalletBinding, BaseViewModel> {
    /**
     * 金额是否可见
     */
    private boolean isVisible = true;
    private TransactionsAdapter adapter;
    private List<String> data = new ArrayList<>();
    private TipsPopupWindow tipsPopupWindow;

    @Override
    protected WalletFrgViewModel bindModel() {
        return getViewModel(this, WalletFrgViewModel.class);
    }

    @Override
    protected void initInject() {
        getFragmentComponent().inject(this);
    }

    @Override
    protected void lazyLoadData() {

    }

    @Override
    protected void initData() {
        tipsPopupWindow = new TipsPopupWindow(mContext);
//        for (int i = 0; i < 6; i++) {
//            data.add("");
//        }
//        adapter = new TransactionsAdapter();
//        binding.recyclerView.setAdapter(adapter);
//        adapter.setEmptyViewEnable(true);
//        adapter.setEmptyViewLayout(mContext, R.layout.transactions_empty_layout);
//        adapter.submitList(data);
    }

    @Override
    protected void initClick() {
//        viewModel.onDelayClick(binding.refreshIv, o -> {
//            ToastHelper.showToast("refresh");
//        });
//
//        viewModel.onDelayClick(binding.include.visibleStatusIv, o -> {
//            isVisible = !isVisible;
//            binding.include.visibleStatusIv.setImageResource(isVisible ? R.mipmap.icon_eye_n : R.mipmap.icon_eye_y);
//            binding.include.moneyTv.setText(isVisible ? mContext.getString(R.string.money, "10.3k") : mContext.getString(R.string.hide_money));
//            binding.include.availableMoneyTv.setText(isVisible ? "100.88" : mContext.getString(R.string.hide_money));
//            binding.include.pendingMoneyTv.setText(isVisible ? "100.88" : mContext.getString(R.string.hide_money));
//            binding.include.withdrawMoneyTv.setText(isVisible ? "100.88" : mContext.getString(R.string.hide_money));
//        });
//
//        viewModel.onDelayClick(binding.include.tipsIv, o -> {
////            tipsPopupWindow.showPopUp(binding.include.tipsIv);
//        });
//
//        viewModel.onDelayClick(binding.include.withdrawTv, o -> {
//            ToastHelper.showToast("Withdraw");
//        });
//
//        viewModel.onDelayClick(binding.include.availableLl, o -> {
//            Bundle bundle = new Bundle();
//            bundle.putInt("flag", 0);
//            JumpIntent.jump(getActivity(), AmountDetailsActivity.class, bundle);
//        });
//
//        viewModel.onDelayClick(binding.include.pendingLl, o -> {
//            Bundle bundle = new Bundle();
//            bundle.putInt("flag", 1);
//            JumpIntent.jump(getActivity(), AmountDetailsActivity.class, bundle);
//        });
//
//        viewModel.onDelayClick(binding.include.withdrawLl, o -> {
//            Bundle bundle = new Bundle();
//            bundle.putInt("flag", 2);
//            JumpIntent.jump(getActivity(), AmountDetailsActivity.class, bundle);
//        });
//
//        viewModel.onDelayClick(binding.viewAllTv, o -> JumpIntent.jump(getActivity(), TransactionsListActivity.class));
    }
}
